package spzx.mapper;

import com.atguigu.spzx.model.dto.system.SysRoleDto;
import com.atguigu.spzx.model.entity.system.SysRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface SysRoleMapper {
    List<SysRole> selectByCondition(SysRoleDto sysRoleDto);

    void addSysRole(SysRole sysRole);

    void deleteById(Long roleId);

    void deleteByIds(@Param("roleIds") List<Long> roleIds);

    void updateSysRole(SysRole sysRole);

    SysRole selectByRoleName(String roleName);

    List<SysRole> findAll();

    List<Long> findRoleIdListBySysUserId(Long sysUserId);

    void deleteUserRole(Long userId);

    //什么情况下会用@Param(something)注解：
    //当方法参数名和数据库字段名不一致时，使用@Param(something)注解来指定参数名。
    void addUserRole(@Param("userId") Long userId, @Param("roleId") Long roleId);
}
